]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ci: Use `meson introspect` to generate artifact path
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 23 May 2024 22:07:11 +0000 (00:07 +0200)
committerMarge Bot <marge-bot@gnome.org>
Fri, 24 May 2024 21:42:01 +0000 (21:42 +0000)
We currently assume that the `CI_COMMIT_TAG` variable matches the
version component of the generated dist tarball.

That is usually correct, but sometimes errors happen and a wrong
tag is pushed, and the real release uses something like "46.0-real".

Account for that by building the artifact path from `meson introspect`
and exporting it as environment variable.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3340>

.gitlab-ci.yml
.gitlab-ci/export-artifact-path [new file with mode: 0755]

index ab8bebc5b439edb869f17114567042caa5f67b3d..59a4f78d9acaa76259889f9c10eb87655ec3cab1 100644 (file)
@@ -264,6 +264,23 @@ flatpak:
 nightly:
   extends: '.publish_nightly'
 
+distinfo:
+  stage: deploy
+  needs:
+    - build
+  script:
+    - .gitlab-ci/export-artifact-path build > dist.env
+  artifacts:
+    reports:
+      dotenv: dist.env
+    paths:
+      - build
+      - mutter
+      - subprojects/jasmine-gjs
+      - dist.env
+  rules:
+    - if: '$CI_COMMIT_TAG'
+
 dist:
   variables:
     XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
@@ -282,13 +299,16 @@ dist:
         - "**/meson.build"
         - meson/*
 
-
 dist-tarball:
   extends: dist
+  needs:
+    - distinfo
   artifacts:
     expose_as: 'Get tarball here'
     paths:
-      - build/meson-dist/$CI_PROJECT_NAME-$CI_COMMIT_TAG.tar.xz
+      - $TARBALL_ARTIFACT_PATH
+    reports:
+      dotenv: dist.env
   rules:
     - if: '$CI_COMMIT_TAG'
 
diff --git a/.gitlab-ci/export-artifact-path b/.gitlab-ci/export-artifact-path
new file mode 100755 (executable)
index 0000000..f9a7534
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/gjs -m
+// SPDX-FileCopyrightText: 2024 Florian Müllner <fmuellner@gnome.org>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+import Gio from 'gi://Gio';
+import {programArgs, programInvocationName, exit} from 'system';
+
+const [buildDir] = programArgs;
+if (!buildDir) {
+    printerr(`usage: ${programInvocationName} <build-dir>`);
+    exit(1);
+}
+
+const subprocess = Gio.Subprocess.new(
+    ['meson', 'introspect', '--projectinfo', buildDir],
+    Gio.SubprocessFlags.STDOUT_PIPE);
+const [, out] = subprocess.communicate_utf8(null, null);
+
+const {descriptive_name, version} = JSON.parse(out);
+print(`TARBALL_ARTIFACT_PATH=${buildDir}/meson-dist/${descriptive_name}-${version}.tar.xz`);